package com.gem.growingtree.activity;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lidroid.xutils.view.annotation.event.OnClick;
import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.BitmapDrawable;
import android.support.v4.view.ViewPager.LayoutParams;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.PopupWindow;
import android.widget.TextView;
public class PlayActivity extends Activity {
	@ViewInject  (R.id.textView_id1)
     private TextView textView;
	@OnClick(R.id.textView_id1)
	 public void onClickNotice(View v){
		Intent intent=new Intent();
		intent.setClass(PlayActivity.this,NoticeActivity.class);
		startActivity(intent);
	}
	
	@ViewInject  (R.id.textView_id3)
     private  TextView textView1;
	@OnClick(R.id.textView_id3)
	 public void onClickTodyPlay(View v){
			Intent intent=new Intent();
			intent.setClass(PlayActivity.this,TodayPlayActivity.class);
			startActivity(intent);
		}
	 
	 protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_play);
	    ViewUtils.inject(this);
		/*textView=(TextView) findViewById(R.id.textView_id1);
		textView.setOnClickListener(new View.OnClickListener() {
			@Override
			public void onClick(View v) {
				Intent intent=new Intent();
				intent.setClass(PlayActivity.this,NoticeActivity.class);
				startActivity(intent);
			}
		});*/
	    LayoutInflater inflater = LayoutInflater.from(this); 
        // 引入窗口配置文件 
        View view = inflater.inflate(R.layout.picture, null); 
        // 创建PopupWindow对象 
        final PopupWindow pop = new PopupWindow(view, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, false); 
        TextView text = (TextView) findViewById(R.id.textView_id2); 
        // 需要设置一下此参数，点击外边可消失 
       pop.setBackgroundDrawable(new BitmapDrawable()); 
        //设置点击窗口外边窗口消失 
       pop.setOutsideTouchable(true); 
        // 设置此参数获得焦点，否则无法点击 
      pop.setFocusable(true); 
      text.setOnClickListener(new OnClickListener() { 
            @Override 
            public void onClick(View v) { 
               if(pop.isShowing()) { 
                    // 隐藏窗口，如果设置了点击窗口外小时即不需要此方式隐藏 
                    pop.dismiss(); 
              } else { 
                    // 显示窗口 
                   pop.showAsDropDown(v); //将窗口以下拉方式显示
                  // pop.showAtLocation(findViewById(R.id.line), Gravity.CENTER, 20, 10);
                } 
            } 
        }); 
   } 
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.play, menu);
		return true;
	}
}
